<script setup lang="ts">
interface Props {
  data: any
}

const props = defineProps<Props>()
</script>

<template>
  <div class="monitor-card-wrapper">
    <div class="title-container">
      <div v-if="props.data.num" class="title">设备编号 - {{ props.data.num }}</div>
      <div v-else class="title">拉取中</div>
    </div>
    <div class="video-container">
      <template v-if="props.data.noMonitor">
        <div class="no-monitor">无监控设备</div>
      </template>
      <template v-else>
        <video v-if="props.data.src" :src="props.data.src"></video>
        <Loading v-else color="var(--theme-color)"></Loading>
      </template>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.monitor-card-wrapper {
  @include rect(100%, 100%);
  @include flex(column, flex-start, flex-start);
  min-height: 250px;
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid #e2e6e8;
  overflow: hidden;
  .title-container {
    @include rect(100%, 45px);
    @include flex(row, flex-start, center);
    box-sizing: border-box;
    padding: 0 12px;
    background: #f5f7f9;
    .title {
      font-family: 'PingFangSC-Regular';
      font-size: 14px;
      font-weight: bold;
      color: #1f2128;
    }
  }
  .video-container {
    @include flex(row, center, center);
    width: 100%;
    flex: 1;
    .no-monitor {
      font-family: 'PingFangSC-Regular';
      font-size: 14px;
      color: var(--theme-color-info-light-2);
    }
  }
}
</style>
